package com.sugon.service.impl;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import com.sugon.dao.KpiMttrDao;
import com.sugon.entity.KpiMttrEntity;
import com.sugon.service.KpiMttrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * KPI中产线MTTR统计，原则上第二天凌晨统计前一天的Service实现类
 *
 * @author sugon
 * @date 2020-07-18 19:43:52
 */
@Service("kpiMttrService")
public class KpiMttrServiceImpl implements KpiMttrService {
    @Autowired
    private KpiMttrDao kpiMttrDao;

    @Override
    public KpiMttrEntity queryObject(String id) {
        return kpiMttrDao.queryObject(id);
    }

    @Override
    public List<KpiMttrEntity> queryList(Map<String, Object> map) {
        return kpiMttrDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return kpiMttrDao.queryTotal(map);
    }

    @Override
    public int save(KpiMttrEntity kpiMttr) {
        kpiMttr.setId(RandomUtil.randomString(32));
        kpiMttr.setGmtCreate(DateUtil.date());
        return kpiMttrDao.save(kpiMttr);
    }

    @Override
    public int update(KpiMttrEntity kpiMttr) {
        return kpiMttrDao.update(kpiMttr);
    }

    @Override
    public int delete(String id) {
        return kpiMttrDao.delete(id);
    }

    @Override
    public int deleteBatch(String[] ids) {
        return kpiMttrDao.deleteBatch(ids);
    }
}
